import tkinter from tkinter import * class FirstGUI: #the function that will be called #when an object of this type is made def __init__(self): self.__mainWindow = tkinter.Tk() self.count = IntVar() self.count.set(0) self.__mainWindow.wm_title('My Title') newButton = tkinter.Button(self.__mainWindow, \ text='Click', \ command=self.buttonClick) newButton.pack() upButton = tkinter.Button(self.__mainWindow, \ text='Up', \ command=self.up) upButton.pack() downButton = tkinter.Button(self.__mainWindow, \ text='Down', \ command=self.down) downButton.pack() label = tkinter.Label(self.__mainWindow, \ textvariable=self.count) label.pack() self.__mainWindow.mainloop() def buttonClick(self): self.__mainWindow.wm_title('New Title') newWindow = FirstGUI() def up(self): self.count.set(self.count.get() + 1) def down(self): self.count.set(self.count.get() - 1) a= FirstGUI()